package be.djdb.game.othello;
import java.awt.Color;
import java.awt.Dialog;
import java.awt.event.ActionListener;

import javax.swing.*;

import be.djdb.generators.MYpanel;
import be.djdb.generators.data.SuperItems;

public class OptiePanel extends JPanel{
	Settings settings;
	private final static int slidermin = 0;
	private final static int slidermax = 255;
	SuperItems items;
    /**
     * Creates new form NewJPanel
     */
    public OptiePanel(Settings setting) {
    	this.settings = setting;
    	items = new SuperItems(Statics.RESOURCENAME); 
    }
	public void initComponents(ActionListener ok, ActionListener cancel) {
        jPanel2 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        Jbtncancel = new JButton(items.getlblFor("cancel"));
        Jbtncancel.addActionListener(cancel);
        Jbtnok = new JButton(items.getlblFor("ok"));
        Jbtnok.addActionListener(ok);
        jTabbedPane2 = new JTabbedPane();
        JpnlPlayer1 = new JPanel();
        Color player1 = settings.getColorPlayer1();
        JSliderplayer1Rood = new JSlider(slidermin,slidermax,player1.getRed());
        JSliderplayer1Groen = new JSlider(slidermin,slidermax,player1.getGreen());
        JSliderplayer1Blauw = new JSlider(slidermin,slidermax,player1.getBlue());
        Color player2 = settings.getColorPlayer1();
        Jlblplayer1Rood = new JLabel(items.getlblFor("red"));
        Jlblplayer1Groen = new JLabel(items.getlblFor("green"));
        Jlblplayer1Blauw = new JLabel(items.getlblFor("blue"));
        JpnlPlayer2 = new JPanel();
        JSliderPlayer2Rood = new JSlider(slidermin,slidermax,player2.getRed());
        JSliderPlayer2Groen = new JSlider(slidermin,slidermax,player2.getGreen());
        JSliderPlayer2Blauw = new JSlider(slidermin,slidermax,player2.getBlue());
        Jlblplayer2rood = new JLabel(items.getlblFor("red"));
        JlblPlayer2Groen = new JLabel(items.getlblFor("green"));
        Jlblplayer2blauw = new JLabel(items.getlblFor("blue"));
        JpnlBord = new JPanel();
        Jlblrijen = new JLabel();
        JtxtRijen = new JTextField(settings.getbordsizeX()+"");
        Jlblkollomen = new JLabel();
        JtxtKollomen = new JTextField(settings.getbordsizeY()+"");
        JlblSterkte = new JLabel();
        JtxtSterkte = new JTextField();
        jPanel10 = new JPanel();
        jScrollPane2 = new JScrollPane();
        jList2 = new JList();

        GroupLayout jPanel2Layout = new GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        GroupLayout jPanel3Layout = new GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        GroupLayout JpnlPlayer1Layout = new GroupLayout(JpnlPlayer1);
        JpnlPlayer1.setLayout(JpnlPlayer1Layout);
        JpnlPlayer1Layout.setHorizontalGroup(
            JpnlPlayer1Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(JpnlPlayer1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(JpnlPlayer1Layout.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
                    .addComponent(Jlblplayer1Blauw, GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
                    .addComponent(Jlblplayer1Groen, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Jlblplayer1Rood, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(JpnlPlayer1Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(JSliderplayer1Rood, GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
                    .addComponent(JSliderplayer1Groen, GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(JSliderplayer1Blauw, GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addContainerGap())
        );
        JpnlPlayer1Layout.setVerticalGroup(
            JpnlPlayer1Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(JpnlPlayer1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(JpnlPlayer1Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                    .addComponent(JSliderplayer1Rood, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Jlblplayer1Rood, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(JpnlPlayer1Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                    .addComponent(JSliderplayer1Groen, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Jlblplayer1Groen, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(JpnlPlayer1Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                    .addComponent(JSliderplayer1Blauw, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Jlblplayer1Blauw, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jTabbedPane2.addTab(items.getlblFor("player1"), JpnlPlayer1);
        GroupLayout JpnlPlayer2Layout = new GroupLayout(JpnlPlayer2);
        JpnlPlayer2.setLayout(JpnlPlayer2Layout);
        JpnlPlayer2Layout.setHorizontalGroup(
            JpnlPlayer2Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(JpnlPlayer2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(JpnlPlayer2Layout.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
                    .addComponent(Jlblplayer2blauw, GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
                    .addComponent(JlblPlayer2Groen, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Jlblplayer2rood, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(JpnlPlayer2Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(JSliderPlayer2Rood, GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
                    .addComponent(JSliderPlayer2Groen, GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(JSliderPlayer2Blauw, GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addContainerGap())
        );
        JpnlPlayer2Layout.setVerticalGroup(
            JpnlPlayer2Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(JpnlPlayer2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(JpnlPlayer2Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                    .addComponent(JSliderPlayer2Rood, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Jlblplayer2rood, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(JpnlPlayer2Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                    .addComponent(JSliderPlayer2Groen, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(JlblPlayer2Groen, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(JpnlPlayer2Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                    .addComponent(JSliderPlayer2Blauw, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Jlblplayer2blauw, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jTabbedPane2.addTab(items.getlblFor("player2"), JpnlPlayer2);
        Jlblrijen.setText(items.getlblFor("rows"));
        JtxtRijen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JtxtRijenActionPerformed(evt);
            }
        });
        Jlblkollomen.setText(items.getlblFor("collums"));
        JlblSterkte.setText(items.getlblFor("force"));
        GroupLayout JpnlBordLayout = new GroupLayout(JpnlBord);
        JpnlBord.setLayout(JpnlBordLayout);
        JpnlBordLayout.setHorizontalGroup(
            JpnlBordLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(JpnlBordLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(JpnlBordLayout.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
                    .addComponent(Jlblrijen, GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
                    .addComponent(Jlblkollomen, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(JlblSterkte, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(JpnlBordLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(JtxtRijen)
                    .addComponent(JtxtKollomen)
                    .addComponent(JtxtSterkte, GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE))
                .addContainerGap())
        );
        JpnlBordLayout.setVerticalGroup(
            JpnlBordLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(JpnlBordLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(JpnlBordLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(JtxtRijen, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(Jlblrijen, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
                .addGroup(JpnlBordLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(Jlblkollomen, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
                    .addComponent(JtxtKollomen, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(JpnlBordLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(JtxtSterkte, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(JlblSterkte, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jTabbedPane2.addTab(items.getlblFor("bord"), JpnlBord);
        jList2.setModel(new AbstractListModel() {
            String[] strings = { "Player-Player", "Player-Computer", "Computer-Player", "Computer-Computer"};
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jList2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        jScrollPane2.setViewportView(jList2);
        GroupLayout jPanel10Layout = new GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE)
                .addContainerGap())
        );
        jTabbedPane2.addTab(items.getlblFor("players"), jPanel10);
        GroupLayout layout = new GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(Jbtnok)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(Jbtncancel))
                    .addComponent(jTabbedPane2))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane2, GroupLayout.PREFERRED_SIZE, 125, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(Jbtnok)
                    .addComponent(Jbtncancel))
                .addGap(0, 11, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents
    public Settings getSettings(){
    	return this.settings;
    }
    private void JtxtRijenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JtxtRijenActionPerformed
    	System.out.println("rijenaction");
    }//GEN-LAST:event_JtxtRijenActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private JButton Jbtncancel;
    private JButton Jbtnok;
    private JLabel Jlblplayer1Rood;
    private JLabel Jlblplayer1Groen;
    private JLabel Jlblplayer1Blauw;
    private JLabel Jlblplayer2rood;
    private JLabel JlblPlayer2Groen;
    private JLabel Jlblplayer2blauw;
    private JLabel Jlblrijen;
    private JLabel Jlblkollomen;
    private JLabel JlblSterkte;
    private JList jList2;
    private JPanel jPanel10;
    private JPanel jPanel2;
    private JPanel jPanel3;
    private JPanel JpnlPlayer1;
    private JPanel JpnlPlayer2;
    private JPanel JpnlBord;
    private JScrollPane jScrollPane2;
    private JSlider JSliderPlayer2Rood;
    private JSlider JSliderPlayer2Groen;
    private JSlider JSliderPlayer2Blauw;
    private JSlider JSliderplayer1Rood;
    private JSlider JSliderplayer1Groen;
    private JSlider JSliderplayer1Blauw;
    private JTabbedPane jTabbedPane2;
    protected JTextField JtxtRijen;
    protected JTextField JtxtKollomen;
    protected JTextField JtxtSterkte;
    // End of variables declaration//GEN-END:variables
}
